{% extends "admin/base_site.html" %}
{% load i18n admin_modify adminmedia graph_tags %}

{% block extrahead %}{{ block.super }}
{% url admin:jsi18n as jsi18nurl %}
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="{{ jsi18nurl|default:"../../../jsi18n/" }}"></script>
{{ media }}
<script type="text/javascript" src="{{ MEDIA_REAL_ESTATE }}admin/js/real_estate_app_tabs.js"></script>
{% endblock %}

{% block extrastyle %}{{ block.super }} <link rel="stylesheet" type="text/css" href="{{ MEDIA_REAL_ESTATE }}admin/css/forms.css" />
{% endblock %}

{% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %}

{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %}

{% block breadcrumbs %}{% if not is_popup %}
   <ul class="breadcrumb">
      <li><a href="{% url admin:index %}"><i class="icon-home" ></i>{% trans "Home" %}</a> <span class="divider">/</span></li>
      {% if opts.app_label == "auth" %}
        {% if perms.auth %}
          <li >{% if has_change_permission %}<a href="../">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %} <span class="divider">/</span></li> 
        {% endif %}
      {% else %}
          <li >{% if has_change_permission %}<a href="../">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %} <span class="divider">/</span></li> 
      {% endif %}
      <li >{% if add %}{% trans "Add" %} {{ opts.verbose_name }}{% else %}{{ original|truncatewords:"18" }}{% endif %}</li>
    </ul>
{% endif %}{% endblock %}

{% block content %}<div id="content-main">

{% block object-tools %}
{% if change %}
  {% if not is_popup %}
        <a href="history/" class="btn pull-right"><i class="icon-list-alt"></i> {% trans "History" %}</a>
    {% if opts.app_label == "auth" %}
      {% if perms.auth.user %}
        {% if has_absolute_url %}<a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="btn pull-right"><i class="icon-eye-open"></i> {% trans "View on site" %}</a>{% endif %}
      {% endif %}
    {% else %}
        {% if has_absolute_url %}<a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="btn pull-right"><i class="icon-eye-open"></i> {% trans "View on site" %}</a>{% endif %}
    {% endif %}
  {% else %}
  <ul class="object-tools">
      <li><a href="../?pop=1" class="historylink">{% trans "Manage list" %}</a></li>
  </ul>
  {% endif %}
{% else %}
  {% if is_popup %}
    <a href="../?pop=1" class="btn"><i class="icon-list-alt"></i> {% trans "Manage list" %}</a></li>
  {% endif %}
{% endif %}
{% endblock %}

<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.module_name }}_form">{% csrf_token %}{% block form_top %}{% endblock %}
<div>
{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
{% if save_on_top %}{% submit_row %}{% endif %}
{% if errors %}
    <div class="alert alert-error">
      {% blocktrans count errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
    </div>
    {{ adminform.form.non_field_errors }}
{% endif %}


  <ul class="nav nav-tabs" id="myTab">
  {% for fieldset in adminform %}
    {% if fieldset.name %}
      <li  class="{% for line in fieldset %}{% if line.errors %}errors {% endif%}{% endfor %}"><a data-toggle="tab" href="#{{ fieldset.name|slugify }}">{{ fieldset.name }}</a></li>
    {% endif %}
  {% endfor %}
  {% for inline_admin_formset in inline_admin_formsets %}
    {% if inline_admin_formset.opts.verbose_name_plural %}
      <li  class="{% for inline_admin_form in inline_admin_formset %}{% for fieldset in inline_admin_form %} {% for line in fieldset %} {% if line.errors %}errors {% endif%}{% endfor %}{% endfor %}{% endfor %}" ><a data-toggle="tab" href="#{{ inline_admin_formset.formset.prefix }}-group">{{ inline_admin_formset.opts.verbose_name_plural|title }}</a></li>
    {% endif %}
  {% endfor %}
  </ul>
<div {% for fieldset in adminform %} {% if fieldset.name %} class="tab-content" {% endif %}{% endfor %} id="{% for fieldset in adminform %}{% for line in fieldset %} {% if line.errors %} errors {% endif%} {% endfor %} {% endfor %}">
{% for fieldset in adminform %}
    {% include "admin/includes/fieldset.html" %}
{% endfor %}

{% block after_field_sets %}{% endblock %}

{% for inline_admin_formset in inline_admin_formsets %}
    {% include inline_admin_formset.opts.template %}
{% endfor %}

{% block after_related_objects %}{% endblock %}
</div>
{% submit_row %}

{% if adminform and add %}
   <script type="text/javascript">document.getElementById("{{ adminform.first_field.auto_id }}").focus();</script>
{% endif %}

{# JavaScript for prepopulated fields #}
{% prepopulated_fields_js %}
</div>
</form></div>
{% endblock %}

{% block sidebar %}
    {% get_linegraph as line_graph %}
    <div class="widget">
        <div class="widget-header">
            <i class="icon-calendar"></i> <h3 style=""> {% trans 'Amounts clicks' %} </h3>
        </div>
        <div class="widget-content">
            {{ line_graph }}
        </div>
    </div>
{% endblock %}